package com.victor9ac.tfm.web.model.comment;

import java.util.List;

import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.annotate.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public class CommentariesView {

	@JsonProperty("commetaries")
	private List<CommentView> commentList;

	public List<CommentView> getCommentList() {
		return commentList;
	}

	public void setCommentList(List<CommentView> commentList) {
		this.commentList = commentList;
	}

	public String toString() {
		return printCommetariesViewable();
	}

	private String printCommetariesViewable() {
		String res;
		if (commentList != null && !commentList.isEmpty()) {
			res = printAllComments();
		} else {
			res = "not found any comments :(";
		}
		return res;
	}

	private String printAllComments() {
		String res;
		res = "Comments:";
		for (CommentView commentView : this.commentList) {
			res += "[" + commentView.toString() + "]\n";
		}
		return res;
	}

}
